<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');?>
<div id="closeParentTime" style="display:none"></div>
<script type="text/javascript">
	window.top.$('#display_center_id').css('display','none');
</script>
<div class="pad-10">
<div id="searchid" style="">
<form name="searchform" action="" method="get" >
<input type="hidden" value="reg_child" name="m">
<input type="hidden" value="goods" name="c">
<input type="hidden" value="init" name="a">
<input type="hidden" value="1" name="search">
<input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash">
<table width="100%" cellspacing="0" class="search-form">
    <tbody>
		<tr>
		<td>
		<div class="explain-col">		
				<?php echo L('goods_name')?>：<input name="goods_name" type="text" value="<?php echo $goods_name?>" class="input-text"  style='width: 200px;' placeholder='输入商品名称关键字可模糊查询...'/>
				<input type="submit" name="search" class="button" value="<?php echo L('search');?>" />
	</div>
		</td>
		</tr>
    </tbody>
</table>
</form>
</div>
<form name="myform" id="myform" action="" method="post" >
<div class="table-list">
    <table width="100%">
        <thead>
            <tr>
			 <th width="16"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');" align='center' ></th>
            <th width="30" align='center' >ID</th>
			<th width="100" align='center' ><?php echo L('goods_name');?></th>
			<th width="100" align='center' ><?php echo L('description');?></th>
			<th width="100" align='center' ><?php echo L('goods_image');?></th>
            <th width="100" align='center' ><?php echo L('goods_original_price');?>(单位:元)</th>
            <th width="100" align='center' ><?php echo L('goods_preferential_price');?>(单位:元)</th>
            <th width="100" align='center' >数量</th>
            <th width="100" align='center' ><?php echo L('ratio');?></th>
            <th width="120" align='center' ><?php echo L('create_time');?></th>
            <th align="center" width="70"><?php echo L('updated_by')?></th>
			<th width="120" align='center' ><?php echo L('operations_manage');?></th>
            </tr>
        </thead>
<tbody>
    <?php
	if(!empty($goods)) {
		
		foreach ($goods as $r) {
	?>
        <tr>
		<td align="center"><input class="inputcheckbox " name="id[]" value="<?php echo $r['id'];?>" type="checkbox"></td>
		<td align='center' ><?php echo $r['id'];?></td>
		<td align='center'><?php echo $r['name'];?></td>
		<td align='center' title='<?php echo strip_tags($r['description']);?>'><?php echo $r['description']?str_cut(strip_tags($r['description']),120):'<font color="red">（未设置）</font>';?></td>
		<td align='center'><?php if ($r['image']){ ?><img src="<?php echo $r['image'];?>" height="60"/><?php }else{echo '<font color="red">（未设置）</font>';}?></td>
		<td align='center'><?php echo $r['original_price']?$r['original_price']:'<font color="red">（未设置）</font>';?></td>
		<td align='center'><?php echo $r['preferential_price']?$r['preferential_price']:'<font color="red">（未设置）</font>';?></td>
		<td align='center'><?php echo $r['num']?$r['num']:'<font color="red">（未设置）</font>'?></td>
		<td align='center'><?php echo $r['ratio']?$r['ratio']:'<font color="red">（未设置）</font>'?></td>
		<td align='center'><?php echo $r['create_time']?></td>
		<td align='center'><?php echo $adminInfo[$r['updated_by']];?></td>
		<td align='center'>
			<a href="?m=reg_child&c=goods&a=edit&id=<?php echo $r['id']?>"><?php echo L('edit')?></a>
		 | <a href="?m=reg_child&c=goods&a=del&id=<?php echo $r['id']?>&cn_name=<?php echo $r['cn_name'];?>" onClick="return confirm('<?php echo L('confirm', array('message' => new_addslashes($r['name'])))?>')"><?php echo L('delete')?></a>
		 </td>

	</tr>
     <?php }
	} else {
		echo "<tr><td colspan='11' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
	}
	?>
</tbody>
     </table>
    <div class="btn"><label for="check_box"><?php echo L('selected_all');?>/<?php echo L('cancel');?></label>
		<input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash">
		<input type="button" class="button" value="<?php echo L('delete');?>" onclick="myform.action='?m=reg_child&c=goods&a=del&dosubmit=1&steps=<?php echo $steps;?>';return confirm_delete()"/>
	</div>
    <div id="pages"><?php echo $pages;?></div>
</div>
</form>
</div>
<script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>cookie.js"></script>
<script type="text/javascript"> 
<!--

function confirm_delete(){
	if(confirm('<?php echo L('confirm', array('message' => L('selected')));?>')) $('#myform').submit();
}

setcookie('refersh_time', 0);
function refersh_window() {
	var refersh_time = getcookie('refersh_time');
	if(refersh_time==1) {
		window.location.reload();
	}
}
setInterval("refersh_window()", 3000);
//-->
</script>
</body>
</html>